{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
    <h3 class="pb-1">分公司录入</h3>
    {if condition="($id == 0)"}
    <table class="layui-table layui-table-form">
        <tr>
            <td class="layui-td-gray">名称</td>
            <td colspan="3">
                <input type="text" name="name"  lay-reqText="名称" placeholder="名称"
                       class="layui-input" value="">
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray">联系人</td>
            <td colspan="3">
                <input type="text"  name="user_name"  lay-reqText="联系人" placeholder="联系人"
                       class="layui-input" value="">
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray">联系人电话</td>
            <td colspan="3">
                <input type="text"  name="user_phone"  lay-reqText="联系人电话" placeholder="联系人电话"
                       class="layui-input" value="">
            </td>
        </tr>
    </table>
    {else/}
    <table class="layui-table layui-table-form">
        <tr>
            <td class="layui-td-gray">名称</td>
            <td colspan="3">
                <input type="text" name="name"  lay-reqText="名称" placeholder="名称"
                       class="layui-input" value="{$detail.name}" >
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray">联系人</td>
            <td colspan="3">
                <input type="text"  name="user_name"  lay-reqText="联系人" placeholder="联系人"
                       class="layui-input" value="{$detail.user_name}" >
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray">联系人电话</td>
            <td colspan="3">
                <input type="text"  name="user_phone"  lay-reqText="联系人电话" placeholder="联系人电话"
                       class="layui-input" value="{$detail.user_phone}" >
            </td>
        </tr>
    </table>
    {/if}
    <div class="pt-1">
        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
    const moduleInit = ['tool', 'employeepicker'];

    function gouguInit() {
        var form = layui.form, tool = layui.tool;
        //监听提交
        form.on('submit(webform)', function (data) {
            let callback = function (e) {
                layer.msg(e.msg);
                if (e.code == 0) {
                    tool.sideClose(1000);
                }
            }
            tool.post("/home/filiale/add", data.field, callback);
            return false;
        });
    }
</script>
{/block}
<!-- /脚本 -->